package gui;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.*;


public class winSystem implements Runnable {
private boolean running,first,close;
	
	/**
	 * Singleton - replacing c'tor
	 */
	public static winSystem instance = new winSystem();
	
	public static winSystem getInstance(){
		return instance;
	}
	
	
	/**
	 * c'tor: mark that the shell is not opened yet
	 */
	private winSystem (){
		
		running = false;		
	}

	
	/**
	 *starts the thread that shows the window
	 */
	public void openGui() {
		
		//call run?
	}
	
	
	/**
	 *create shell with canvas, button and all needed
	 */
	public void run(){
		
		//there are 4 buttons same as robots. make ot nicer. 
		//stop/start etc.. will go threw command to service manager
		
		//create widgets needed
		/*final Display display= new Display();
		Shell shell = new Shell();
		shell.setText("System control"); 
		shell.setSize(500, 500);
		shell.setLayout(new GridLayout());
		Group group1 = new Group(shell, SWT.NONE);
		GridLayout group1Layout = new GridLayout();
		group1Layout.numColumns = 4;
		group1.setLayout(group1Layout);

		//create 4 buttons
		final Button b1 = new Button(group1,SWT.PUSH |  SWT.DOWN | SWT.RIGHT);
		final Button b2 = new Button(group1,SWT.PUSH |  SWT.DOWN | SWT.RIGHT);
		final Button b3 = new Button(group1,SWT.PUSH |  SWT.DOWN | SWT.RIGHT);
		final Button b4 = new Button(group1,SWT.PUSH |  SWT.DOWN | SWT.RIGHT);

		
		//set the restart button 
		b1.setLayoutData(new GridData());
		b1.setText("Start");
		b1.addSelectionListener(new SelectionListener(){

			@Override
			public void widgetDefaultSelected(SelectionEvent arg0) {
				// TODO Auto-generated method stub
				
			}

			@Override
			public void widgetSelected(SelectionEvent arg0) {
				// TODO Auto-generated method stub
				
			}
			
		});
		
		b2.setLayoutData(new GridData());
		b2.setText("Pause");
		b2.addSelectionListener(new SelectionListener(){

			@Override
			public void widgetDefaultSelected(SelectionEvent arg0) {
				// TODO Auto-generated method stub
				
			}

			@Override
			public void widgetSelected(SelectionEvent arg0) {
				// TODO Auto-generated method stub
				
			}
			
		});


		//set the continue button
		b3.setLayoutData(new GridData());
		b3.setText("Continue");
		b3.addSelectionListener(new SelectionListener(){

			@Override
			public void widgetDefaultSelected(SelectionEvent arg0) {
				// TODO Auto-generated method stub
				
			}

			@Override
			public void widgetSelected(SelectionEvent arg0) {
				// TODO Auto-generated method stub
				
			}
		
		});

		//set the stop button
		b4.setLayoutData(new GridData());
		b4.setText("Stop");
		b4.addSelectionListener(new SelectionListener(){

			@Override
			public void widgetDefaultSelected(SelectionEvent arg0) {
				// TODO Auto-generated method stub
				
			}

			@Override
			public void widgetSelected(SelectionEvent arg0) {
				// TODO Auto-generated method stub
			}
				
		});
			



		//open shell until needed to close
		shell.open();
		while (!shell.isDisposed() && !close) {
			if (!display.readAndDispatch()) {
				display.sleep();
			}
		}
		
		//close the shell and marked as close
		display.dispose();
		running = false;
		close = false;
		*/
	}


	public void open() {
		// TODO Auto-generated method stub
		
	}
	
	
}

